<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>新增配置模板</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/layer/skin/espresso/style.css"></link>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/layer/skin/layer.css" id="layui_layer_skinlayercss"/>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/jquery.ui.css"></link>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/base.css"></link>
	
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.ui.js"></script>

	<style>
		.bigtitle{
			font-family:Arial;
			font-weight:bold;
			font-size:22px;
			margin-bottom:10px;
		}
		.footer{
			font-family:Arial;
			font-weight:bold;
			font-size:12px;
			color:#747474;
		}
	
		.title{
			padding-left:10px;
			font-family:Arial;
			/*font-weight:bold;*/
			font-size:18px;
			color:#747474;
		}
	
		.fromtitle{
			background-color:#f5f5f5;
			text-align:center;
			font-family:Arial;
			color:#acac59;
			padding-top:5px;
			padding-bottom:5px;
		}
	
		.fromcontent{
			font-family:Arial;
			padding-right:5px;
			padding-bottom:10px;
			padding-top:10px;
		}
	
		.content{
			font-family:Arial;
		}
		.clickbtn{
			cursor:pointer;
		}
		.headerbg{
			background:#328aa4 url(img/tr_back.gif) repeat-x;color:#fff;
			height:27px;
			font-family:"Arial";
		}
		.headerbg td{
			text-align:center;
		}
	
	
		.tabletree4j-gird td{
		height:27px;
		}
	
		.arrow-tt-node-content{
			text-align:center;
			width:100%;
		}
		.circle-tt-node-content{
			text-align:center;
			width:100%;
		}
		.default-tt-node-content{
			text-align:center;
			width:100%;
		}
	</style>
	
	<style type="text/css">
    .textarea {width: 80%; height:80px; padding: 10px; boder:1px solid #ddd; border-radius: 10px; box-shadow: inset 5px 5px 5px #eee;resize:none;}
    .tags {padding: 15px;}
    .tags .tag-link {cursor: pointer; display: inline-block; padding: 5px 10px; margin-right: 10px; border:1px solid #fff;}
    .tags .tag-link:hover {color: #f60;}
    .view {position: relative; padding-left: 80px;}
    .view .view-title {position: absolute; width: 75px; top: 0; left: 0; text-align: right;}

    .moretip-text {white-space: normal; word-break: break-all; word-wrap: break-word; width: 310px; margin-right: 0;}
	</style>
	
	
	<script language="javascript">
	function defaultConfig() {
		$("#controlModelOn").val();
		$("#controlModelDown").val();
		$("#turnonVol").val();
		$("#turnonTime").val("17:55");
		$("#shutdownTime").val("23:59");
		$("#workModel").val();
		$("#topVol").val("12");
		$("#lowVol").val("10");
		$("#exitVol").val("11");
		$("#lowStartVol").val("9");
		$("#lowEndVol").val("6");
		$("#maxWorkCurrent").val("11");
		$("#time1").val("6");
		$("#workCurrent1").val("1");
		$("#time2").val("6");
		$("#workCurrent2").val("1");
		$("#time3").val("6");
		$("#workCurrent3").val("1");
		$("#time4").val("6");
		$("#workCurrent4").val("1");
	}
	
	function submitAdd() {
		var templateName = $("#templateName").val();
		if(templateName=="") {
			alert("请输入模板名称");
			return;
		}
		
		var controlModelOn = $("#controlModelOn").val();
		var controlModelDown = $("#controlModelDown").val();
		var turnonVol = $("#turnonVol").val();
		var turnonTime =  $("#turnonTime").val();
		var shutdownTime = $("#shutdownTime").val();
		var workModel = $("#workModel").val();
		var topVol = $("#topVol").val();
		if(topVol=="") {
			alert("请输入峰值保护");
			return;
		}
		var lowVol =  $("#lowVol").val();
		if(lowVol=="") {
			alert("请输入欠压保护");
			return;
		}
		var exitVol = $("#exitVol").val();
		if(exitVol=="") {
			alert("请输入退出保护");
			return;
		}
		var lowStartVol = $("#lowStartVol").val();
		if(lowStartVol=="") {
			alert("请输入降功率起始电压");
			return;
		}
		
		var lowEndVol = $("#lowEndVol").val();
		if(lowEndVol=="") {
			alert("请输入降功率终止电压");
			return;
		}
		
		var maxWorkCurrent = $("#maxWorkCurrent").val();
		if(maxWorkCurrent=="") {
			alert("请输入最大负载电流");
			return;
		}
		
		var time1 = $("#time1").val();
		if(time1=="") {
			alert("请输入1段时长");
			return;
		}
		var workCurrent1 = $("#workCurrent1").val();
		if(workCurrent1=="") {
			alert("请输入1段电流");
			return;
		}
		var time2 = $("#time2").val();
		if(time2=="") {
			alert("请输入2段时长");
			return;
		}
		var workCurrent2 = $("#workCurrent2").val();
		if(workCurrent2=="") {
			alert("请输入2段电流");
			return;
		}
		var time3 = $("#time3").val();
		if(time3=="") {
			alert("请输入3段时长");
			return;
		}
		var workCurrent3 = $("#workCurrent3").val();
		if(workCurrent3=="") {
			alert("请输入3段电流");
			return;
		}
		var time4 = $("#time4").val();
		if(time4=="") {
			alert("请输入4段时长");
			return;
		}
		var workCurrent4 = $("#workCurrent4").val();
		if(workCurrent4=="") {
			alert("请输入4段电流");
			return;
		}
		
		$("#form1").submit();
	}
	
	function modelChange() {
		var controlModelOn = $("#controlModelOn").val();
		var controlModelDown = $("#controlModelDown").val();
		
		if(controlModelOn=="2" && controlModelDown=="2") {
			$("#onVolDiv").css("display","none");
			$("#onVolDivS").css("display","none");
		}else {
			$("#onVolDiv").css("display","block");
			$("#onVolDivS").css("display","block");
		}
		
		if(controlModelOn=="1") {
			$("#timeonDiv").css("display","none");
			$("#timeonDivS").css("display","none");
		}else {
			$("#timeonDiv").css("display","block");
			$("#timeonDivS").css("display","block");
		}
		if(controlModelDown=="1") {
			$("#timedownDiv").css("display","none");
			$("#timedownDivS").css("display","none");
		}else {
			$("#timedownDiv").css("display","block");
			$("#timedownDivS").css("display","block");
		}
		
		if(controlModelOn=="2" && controlModelDown=="1") {
			$("#onVolDivDoc").text("关灯电压：");
		}else {
			$("#onVolDivDoc").text("开灯电压：");
		}
		
	}
	</script>
  </head>
  
  <body>

	<div style="background:#f8f8f8;">
		<div class="layui-layer-title" style="color:#336ca3;font-size: 18;">
			<span class="title-h2">添加配置模板</span>
		</div>
		<div class="layui-layer-content">
			<div class="fahuo-layer-div layui-layer-wrap">
				<div class="form-div">
				<form id="form1"
					action="${pageContext.request.contextPath }/addConfigTemplate.do"
					method="post">
					<div class="view view160">
			            <span class="view-title">项目配置名称：</span>
			            <input id="templateName" name="templateName" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">*</i>
			        </div>
			        <div class="block15"></div>
					<div class="view view160">
			            <span class="view-title">控制模式：</span>
			            <select id="controlModelOn" name="controlModelOn" onchange="modelChange()" class="hw_input6">
			            	<option value="1">光控开灯</option>
			            	<option value="2">时控开灯</option>
			            </select>
			            <select id="controlModelDown" name="controlModelDown" onchange="modelChange()" class="hw_input6">
			            	<option value="1">光控关灯</option>
			            	<option value="2">时控关灯</option>
			            </select>
			            <i class="ico-must">*</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160" id="onVolDiv">
			            <span class="view-title" id="onVolDivDoc">开灯电压：</span>
			            <input id="turnonVol" name="turnonVol" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (V)</i>
			        </div>
			        <div class="block15" id="onVolDivS"></div>
			        <div class="view view160" id="timeonDiv" style="display:none;">
			            <span class="view-title">开灯时间：</span>
			            <input id="turnonTime" name="turnonTime" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">*</i>
			        </div>
			        <div class="block15" id="timeonDivS" style="display:none;"></div>
			        <div class="view view160" id="timedownDiv" style="display:none;">
			            <span class="view-title">关灯时间：</span>
			            <input id="shutdownTime" name="shutdownTime" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">*</i>
			        </div>
			        <div class="block15" id="timedownDivS" style="display:none;"></div>
			        <div class="view view160">
			            <span class="view-title">工作模式：</span>
			            <select id="workModel" name="workModel" class="hw_input6">
			            	<option value="01">智能</option>
			            	<option value="00">非智能</option>
			            </select>
			            <i class="ico-must">*</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">峰值保护：</span>
			            <input id="topVol" name="topVol" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (V)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">欠压保护：</span>
			            <input id="lowVol" name="lowVol" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (V)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">退出保护：</span>
			            <input id="exitVol" name="exitVol" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (V)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">降功率起始电压：</span>
			            <input id="lowStartVol" name="lowStartVol" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (V)</i>
			        </div>
			         <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">降功率终止电压：</span>
			            <input id="lowEndVol" name="lowEndVol" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (V)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">负载最大电流：</span>
			            <input id="maxWorkCurrent" name="maxWorkCurrent" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (mA)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">1段时长：</span>
			            <input id="time1" name="time1" class="hw_input3" maxlength="50" type="text"/>
			            <i class="ico-must">* (以分钟为单位)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">1段功率：</span>
			            <input id="workCurrent1" name="workCurrent1" class="hw_input3" maxlength="50" type="text"/>
			            <i class="ico-must">* (mA)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">2段时长：</span>
			            <input id="time2" name="time2" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (以分钟为单位)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">2段功率：</span>
			            <input id="workCurrent2" name="workCurrent2" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (mA)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">3段时长：</span>
			            <input id="time3" name="time3" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (以分钟为单位)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">3段功率：</span>
			            <input id="workCurrent3" name="workCurrent3" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (mA)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">4段时长：</span>
			            <input id="time4" name="time4" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (以分钟为单位)</i>
			        </div>
			        <div class="block15"></div>
			        <div class="view view160">
			            <span class="view-title">4段功率：</span>
			            <input id="workCurrent4" name="workCurrent4" class="hw_input3" maxlength="50" type="text" />
			            <i class="ico-must">* (mA)</i>
			        </div>
			        <div class="block15"></div>
					<div class="layui-layer-btn">
						<a class="layui-layer-btn0" onclick="submitAdd();">确定</a>
						<a class="layui-layer-btn0" onclick="defaultConfig();">默认配置</a>
						<a class="layui-layer-btn1">取消</a>
					</div>
				</form>
			</div>
			</div>
		</div>
	</div>
  </body>
</html>
